<?php
	session_start();
	include("connect.php");
	$username = array("longjian", "huimin", "luowei");
	$userid = array_keys($username, $_SESSION['userinfo']);
	$acc = $_POST['Account'];
	$bill = intval(strtok($acc, " "));
	if ($bill==0) {
		   echo "<br><br><br><br>";
	       echo "<h1 align='center'>Don't mess with me!</h1>";
	       echo "<br>";
	       echo "<div style='text-align:center;'>";
	       echo "<a href='../homebill/detail.php'>Get back</a>";
	       echo "</div>";
		   exit;
	}
	else{
		$note = strtok("");
		$user = $userid[0];
		mysql_query("INSERT INTO detail(Userid, money, note) VALUES ('$user', '$bill', '$note')");
		echo "sucess";
		echo "<script language='javascript'>";
		echo "setTimeout(self.location='detail.php','3000');";
		echo "</script>";	
	}
	
?>